package bizlogic;

import java.util.ArrayList;

import model.LeaveTypeDTO;

import dao.DAOException;
import dao.DAOFactory;
import dao.LeaveTypeDAO;

public class LeaveTypeManager {
	private LeaveTypeDAO leaveTypeDAO;
	public LeaveTypeManager() {
		leaveTypeDAO = DAOFactory.loadInstance().getLeaveTypeDAO();
	}
	/*@SuppressWarnings("finally")
	public ArrayList<LeaveTypeDTO> findLeavesByCriteria(LeaveSearchDTO hso){
		ArrayList<LeaveTypeDTO> currentList = new ArrayList<LeaveTypeDTO>();
		try {
			currentList = leaveDAO.findLeaveByCriteria(hso);
		} catch (DAOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally
		{
			return currentList;
		}
		
	}*/
	@SuppressWarnings("finally")
	public LeaveTypeDTO findLeaveType(String name){
		LeaveTypeDTO currentLeave = new LeaveTypeDTO();
		try {
			currentLeave = leaveTypeDAO.findLeaveType(name);
		} catch (DAOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally
		{
			return currentLeave;
		}
		
	}
    @SuppressWarnings("finally")
	public ArrayList<LeaveTypeDTO> findAllLeave() {
    	ArrayList<LeaveTypeDTO> currentList = new ArrayList<LeaveTypeDTO>();
		try {
			currentList = leaveTypeDAO.findAllLeaveType();
		} catch (DAOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally
		{
			return currentList;
		}
    }   
    

}
